package com.vincent.web;

import com.vincent.service.KafkaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by vincent on 2018/8/4.
 */
@RestController
@RequestMapping("/kafka")
public class KafkaController {
    @Autowired
    private KafkaService kafkaService;

    @GetMapping("/send")
    public void send(@RequestParam String topic, @RequestParam String key,@RequestParam String value){
        kafkaService.send(topic, key, value);
    }
    @GetMapping("/receive")
    public void receive(){
        kafkaService.receive("test-spring-kafka","test");
    }
}
